#include <TFT_eSPI.h>

void draw_data(TFT_eSprite tft_in, float data, int X, int Y) {
   
  if (data <= -1) {
    tft_in.drawString("-", 0, 63, 2);         // draw at 6,0 in sprite, font 2
    tft_in.drawNumber(abs(data), 33, 63, 2);  // plot value in font 2 更新数字
    tft_in.pushSprite(X, Y);                  //设置坐标
    tft_in.scroll(0, -16);                    // scroll stext 0 pixels left/right, 16 up
  } else if (data >= 0) {
    tft_in.drawNumber((int)data, 33, 63, 2);  // plot value in font 2 更新数字
    tft_in.pushSprite(X, Y);                  //设置坐标
    tft_in.scroll(0, -16);                    // scroll stext 0 pixels left/right, 16 up
  }else{
    tft_in.drawNumber(0, 33, 63, 2);  // plot value in font 2 更新数字
    tft_in.pushSprite(X, Y);                  //设置坐标
    tft_in.scroll(0, -16);         
  }
}

void draw_content(TFT_eSprite tft_in, char *data, int X, int Y) {
  tft_in.pushSprite(X, Y);           //设置坐标
  tft_in.drawString(data, 6, 0, 2);  // draw at 6,0 in sprite, font 2
}

void draw_float(TFT_eSprite tft_in, float data, int X, int Y) {
  tft_in.pushSprite(X, Y);          //设置坐标
  tft_in.drawFloat(data, 6, 0, 2);  // draw at 6,0 in sprite, font 2
}
